package com.ruoyi.wms.service.impl;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.wms.domain.WmsInventory;
import com.ruoyi.wms.mapper.WmsInventoryMapper;
import com.ruoyi.wms.service.IWmsInventoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 库存Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-10-08
 */
@Service
public class WmsInventoryServiceImpl implements IWmsInventoryService 
{
    @Autowired
    private WmsInventoryMapper wmsInventoryMapper;

    /**
     * 查询库存
     * 
     * @param id 库存ID
     * @return 库存
     */
    @Override
    public WmsInventory selectWmsInventoryById(Long id)
    {
        return wmsInventoryMapper.selectWmsInventoryById(id);
    }

    /**
     * 查询库存列表
     * 
     * @param wmsInventory 库存
     * @return 库存
     */
    @Override
    public List<WmsInventory> selectWmsInventoryList(WmsInventory wmsInventory)
    {
        return wmsInventoryMapper.selectWmsInventoryList(wmsInventory);
    }

    /**
     * 新增库存
     * 
     * @param wmsInventory 库存
     * @return 结果
     */
    @Override
    public int insertWmsInventory(WmsInventory wmsInventory)
    {
        wmsInventory.setCreateTime(DateUtils.getNowDate());
        return wmsInventoryMapper.insertWmsInventory(wmsInventory);
    }

    /**
     * 修改库存
     * 
     * @param wmsInventory 库存
     * @return 结果
     */
    @Override
    public int updateWmsInventory(WmsInventory wmsInventory)
    {
        wmsInventory.setUpdateTime(DateUtils.getNowDate());
        return wmsInventoryMapper.updateWmsInventory(wmsInventory);
    }

    /**
     * 批量删除库存
     * 
     * @param ids 需要删除的库存ID
     * @return 结果
     */
    @Override
    public int deleteWmsInventoryByIds(Long[] ids)
    {
        return wmsInventoryMapper.deleteWmsInventoryByIds(ids);
    }

    /**
     * 删除库存信息
     * 
     * @param id 库存ID
     * @return 结果
     */
    @Override
    public int deleteWmsInventoryById(Long id)
    {
        return wmsInventoryMapper.deleteWmsInventoryById(id);
    }
}
